var t = require("../../../api.js"), n = getApp();

require("../../../utils/function.js");

Page({
    data: {
        polyline: [ {
            points: [],
            color: "#000000",
            width: 5
        } ],
        markers: [],
        location: {
            lat: "",
            lng: ""
        }
    },
    onLoad: function(o) {
        var i = this;
        n.request({
            url: t.order.track,
            method: "post",
            data: {
                order_no: o.order_no
            },
            success: function(t) {
                var n = JSON.parse(t.data.position_point), o = [ {
                    id: 0,
                    iconPath: "../../../images/user/icon-44.png",
                    latitude: n[0].latitude,
                    longitude: n[0].longitude,
                    width: 40,
                    height: 40
                }, {
                    id: 1,
                    iconPath: "../../../images/user/icon-43.png",
                    latitude: n[n.length - 1].latitude,
                    longitude: n[n.length - 1].longitude,
                    width: 40,
                    height: 40
                } ], a = {
                    lat: n[0].latitude,
                    lng: n[0].longitude
                };
                i.setData({
                    location: a,
                    polyline: [ {
                        points: n,
                        color: "#000000",
                        width: 7
                    } ],
                    makes: o
                });
            }
        });
    },
    getDistance: function(t, n, o, i) {
        var a = t * Math.PI / 180, e = o * Math.PI / 180, u = a - e, s = n * Math.PI / 180 - i * Math.PI / 180, h = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(u / 2), 2) + Math.cos(a) * Math.cos(e) * Math.pow(Math.sin(s / 2), 2)));
        return h *= 6378.137, h = Math.round(1e4 * h) / 1e4;
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});